use cosmwasm_std::{HumanAddr, Uint128};
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};

use crate::{pool::PoolInfo, staker::StakePeriod};

#[derive(Serialize, Deserialize, JsonSchema)]
pub struct InstantiateMsg {
    pub owner: Option<HumanAddr>,
}

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum ExecuteMsg {
    AddPool {
        pool: PoolInfo,
    },
    UpdatePool {
        pool: PoolInfo,
    },
    UpdateOwner {
        new_owner: HumanAddr,
    },
    Deposit {
        pool_id: u8,
        stake_amount: Uint128,
        stake_period: StakePeriod,
    },
    Withdraw {
        pool_id: u8,
        withdraw_amount: Uint128,
        withdraw_period: StakePeriod,
    },
    WithdrawReward {
        pool_id: u8,
    },
    WithdrawStake {
        pool_id: u8,
    },
}

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum QueryMsg {
    Config(),
    Pool {
        pool_id: u8,
    },
    Pools {},
    Staker {
        address: HumanAddr,
        block_time: u64,
        pool_id: u8,
    },
}

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum Action {
    Deposit(String),
    WithDraw(String),
}
